#include <iostream>
#include <string.h>
#include <malloc.h>

using namespace std;

int sum=0;
char str[]="hhart";
int length;
char *out;

void DoCombine(char in[], char out[], int length, int rec, int start)
{
	int i;
	for(int i=start; i<length;i++)
	{
		out[rec]=in[i];
		out[rec+1]=0;
		cout<<out<<endl;
		if(i<length-1)
			DoCombine(in, out, length, rec+1, i+1);
	}
}
int main()
{
	length=strlen(str);
	out=(char *)malloc(length+1);
	DoCombine(str,out,length,0,0);
	return 0;
}
